From: Felix Fietkau Date: Mon, 20 Oct 2025 17:43:14 +0000 (+0200) Subject: veth: delete device before creation to handle stale state X-Git-Url: http://git.openwrt.org/%22http:/oss.oetiker.ch/rrdtool//%22/%22http:/oss.oetiker.ch/rrdtool/%22?a=commitdiff_plain;h=df2f5c9a30f8faadf8dee962cc17d315e967d70a;p=project%2Fnetifd.git veth: delete device before creation to handle stale state When a veth device already exists in the kernel (from a previous failed cleanup or external creation), attempting to create it again with NLM_F_EXCL fails with -EEXIST. This leaves the device in a broken state where netifd marks it as present but cannot bring it up. Signed-off-by: Felix Fietkau --- diff --git a/veth.c b/veth.c index 46b6eff..2f03456 100644 --- a/veth.c +++ b/veth.c @@ -68,6 +68,8 @@ veth_set_up(struct veth *veth) { int ret; + system_veth_del(&veth->dev); + ret = system_veth_add(&veth->dev, &veth->config); if (ret < 0) return ret;